package com.xuecheng.content.feignclient;

import com.xuecheng.base.model.PageParams;
import com.xuecheng.search.dto.SearchCourseParamDto;
import com.xuecheng.search.dto.SearchPageResultDto;
import com.xuecheng.search.po.CourseIndex;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ Author：祝文龙
 * @ Date：2023-11-27-17:24
 * @ Version：1.0
 * @ Description：搜索远程接口降级处理
 */
@Component
@Slf4j
public class SearchServiceClientFallbackFactory implements FallbackFactory<SerachServiceClient> {

    @Override
    public SerachServiceClient create(Throwable throwable) {
        return new SerachServiceClient() {
            @Override
            public Boolean add(CourseIndex courseIndex) {

                log.debug("添加课程索引发生熔断，索引信息:{},熔断的异常信息:{}",courseIndex,throwable.toString(),throwable);
//                走降级，返回false
                return false;
            }
        };
    }
}
